/*
 * Copyright 2011 Fabian Wenzelmann
 * 
 * This file is part of Recognition-Procedures-for-Boolean-Functions.
 * 
 * Recognition-Procedures-for-Boolean-Functions is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * Recognition-Procedures-for-Boolean-Functions is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with Recognition-Procedures-for-Boolean-Functions.  If not, see <http://www.gnu.org/licenses/>.
 */

package de.wenzelmf.booleanFunction.lpb.combinatorial.splittingTree;

import de.wenzelmf.booleanFunction.dnf.DNF;
import de.wenzelmf.booleanFunction.lpb.combinatorial.occurrencePattern.OccurrencePattern;

/**
 * This class stores the elements returned by the {@link SplittingTreeNode#split(boolean, VariableSetting)}
 * method (and all other methods of that type).
 * 
 * It encapsulates a DNF, the occurrence patterns of the DNF and the information if the DNF represents
 * <i>true</i> or <i>false</i>.
 * 
 * @author Fabian Wenzelmann
 * @version 1.0
 *
 */
public class SplitResult
{
	/**
	 * The DNF.
	 */
	protected DNF dnf;
	/**
	 * The occurrence patterns of the DNF (with the variable sorted).
	 */
	protected OccurrencePattern[] patterns;
	/**
	 * True if this DNF represents <i>true</i> or <i>false</i>, {@code null} means that it is
	 * unknown.
	 */
	protected Boolean isFinal;
	
	/**
	 * Construct a new SplitResult.
	 * 
	 * @param dnf The DNF.
	 * @param patterns The occurrence patterns of the DNF.
	 * @param isFinal {@code true} if the DNF is <i>true</i> or <i>false</i>, {@code null}
	 * indicates that this is unknown.
	 */
	public SplitResult(DNF dnf, OccurrencePattern[] patterns, Boolean isFinal)
	{
		this.dnf = dnf;
		this.patterns = patterns;
		this.isFinal = isFinal;
	}
	
	/**
	 * Construct a new SplitResult.
	 * 
	 * The {@link #isFinal()} information is set to {@code null}, which means that it is unknown.
	 * 
	 * @param dnf The DNF.
	 * @param patterns The occurrence patterns of the DNF.
	 */
	public SplitResult(DNF dnf, OccurrencePattern[] patterns)
	{
		this(dnf, patterns, null);
	}
	
	/**
	 * Returns the DNF.
	 * 
	 * @return The DNF.
	 */
	public DNF getDnf()
	{
		return dnf;
	}
	
	/**
	 * Returns the occurrence patterns of the DNF (should be sorted).
	 * 
	 * @return The occurrence patterns of the DNF.
	 */
	public OccurrencePattern[] getPatterns()
	{
		return patterns;
	}
	
	/**
	 * Returns {@code true} if the DNF represents <i>true</i> or <i>false</i> and {@code null}
	 * if it is unknown..
	 * 
	 * @return {@code true} if the DNF represents <i>true</i> or <i>false</i> and {@code null}
	 * if it is unknown.
	 */
	public Boolean isFinal()
	{
		return isFinal;
	}
	
}
